//
//  SVGEllipse.m
//  Shake and Bake
//
//  Created by Antoine Quint on 12/08/07.
//  Copyright 2007 __MyCompanyName__. All rights reserved.
//

#import "SVGEllipse.h"


@implementation SVGEllipse

- (id)initWithAttributeDict:(NSDictionary *)attributesDict andView:(Canvas *)aView
{
  [super initWithAttributeDict:attributesDict andView:aView];
	if (self) {
		// parse attribute values
		cx = [[attributes objectForKey:@"cx"] floatValue];
		cy = [[attributes objectForKey:@"cy"] floatValue];
		rx = [[attributes objectForKey:@"rx"] floatValue];
		ry = [[attributes objectForKey:@"ry"] floatValue];
		//
		self.position = CGPointMake(cx - rx, cy - ry); 
		self.bounds = CGRectMake(0.0f, 0.0f, rx * 2, ry * 2);
		self.name = @"ellipse";
	}
	return self;
}

- (void)makePath:(CGContextRef)context
{
	CGContextAddEllipseInRect(context, CGRectMake(0.0f, 0.0f, rx * 2, ry * 2));
}

@end
